package nodes.binary;

import nodes.AbstractNode;
import nodes.ConstantNode;
import model.Model;

/**
 * Used for representing "and" in the expression tree
 */
public class AndNode extends AbstractBinaryNode
{

    public AndNode (Model model)
    {
        super(model);
        myName = syntaxBundle.getString("and_label");
    }

    public AbstractNode evaluate ()
    {
        if(myLeft.evaluate().getValue() != 0 && myRight.evaluate().getValue() != 0) return new ConstantNode(1);
        else return new ConstantNode(0,myModel);
    }

}
